package com.parachutes.aspinterfacecore.controller;

import com.github.pagehelper.PageInfo;
import com.github.pagehelper.page.PageMethod;
import com.parachutes.aspinterfaceapi.domain.BusInterfaceInvokeRecord;
import com.parachutes.aspinterfaceapi.domain.Result;
import com.parachutes.aspinterfaceapi.service.BusInterfaceInvokeRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 总线接口调用记录控制器
 *
 * @author machi
 * @date 2025/01/29
 */
@RestController
@RequestMapping("/invoke/record")
public class BusInterfaceInvokeRecordController {

  @Autowired
  private BusInterfaceInvokeRecordService busInterfaceInvokeRecordService;


    /**
     * 列出所有接口调用记录
     *
     * @return {@link Result }<{@link ? }>
     */
    @GetMapping("list")
    public Result<?> list(Integer page, Integer pageSize) {
        PageMethod.startPage(page, pageSize);
        List<BusInterfaceInvokeRecord> list = busInterfaceInvokeRecordService.list();
        PageInfo<BusInterfaceInvokeRecord> pageInfo = new PageInfo<>(list);
        return Result.of(true, "获取成功", pageInfo);
    }
}
